package com.basics.common.utils.oss;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serializable;


@Data
public class UploadChunkFileReq implements Serializable {

    /**
     * 文件传输任务ID
     * 文件MD5编码
     */
    @ApiModelProperty(value = "文件传输任务ID")
    private String identifier;

    /**
     * 文件全名称 例如：123.png
     */
    @ApiModelProperty(value = "文件全名称 例如：123.png")
    private String filename;

    /**
     * 分片总数
     */
    @ApiModelProperty(value = "分片总数")
    private int totalChunks;

    /**
     * 每个分块的大小
     */
    @ApiModelProperty(value = "每个分块的大小")
    private long chunkSize;
    /**
     * 当前为第几分片
     */
    @ApiModelProperty(value = "当前为第几分片")
    private int chunkNumber;
    /**
     * 当前分片大小
     */
    @ApiModelProperty(value = "当前分片大小")
    private long currentChunkSize;

//    /**
//     * 分块文件传输对象
//     */
//    @ApiModelProperty(value = "分块文件传输对象")
//    private MultipartFile file;

    /**
     * oss上传时的上传id
     */
    @ApiModelProperty(value = "oss上传时的上传id(上一次分片上传后会返回,第一次是没有的)")
    private String uploadId;

    @ApiModelProperty(value = "上传目录(可根据业务自己分一下,不传会默认)")
    private String dir;

    public UploadChunkFileReq(){

    }
    public UploadChunkFileReq(String identifier, String filename,
                              int totalChunks, long chunkSize,
                              int chunkNumber, long currentChunkSize, String uploadId, String dir){
        this.identifier = identifier;
        this.filename = filename;
        this.totalChunks = totalChunks;
        this.chunkSize = chunkSize;
        this.chunkNumber = chunkNumber;
        this.currentChunkSize = currentChunkSize;
        this.uploadId = uploadId;
        this.dir = dir;
    }
}
